import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Jiang Jinxi
 * Date: 2024-05-18
 * Time: 14:48
 */
public class Queue {
    private int[] element;
    private int size;
    public Queue(){
        element = new int[8];
    }
    private void ensureCapacity(){
        if(size == element.length){
            element = Arrays.copyOf(element,element.length*2);
        }
    }
    public void enqueue(int v){
        ensureCapacity();
        element[size] = v;
        size++;
    }
    public int dequeue(){
        int n = element[0];
        for (int i = 0; i < size; i++) {
            element[i] = element[i+1];
        }
        size--;
        return n;
    }
    public boolean empty(){
       return size == 0;
    }
    public int getSize(){
        return size;
    }
}
